package com.zhj.rpc.register;

import com.zhj.rpc.pojo.URL;

import java.util.HashMap;
import java.util.Map;

/**
 * @author zhj
 */
public class NativeRegistry {
    private static Map<String,Map<URL,Class>> registryCenter = new HashMap<>();

    /**
     * 注册
     * @param interfaceName
     * @param url
     * @param implClass
     */
    public static void registry(String interfaceName, URL url, Class implClass) {
        Map<URL,Class> map = new HashMap<>();
        map.put(url,implClass);
        registryCenter.put(interfaceName, map);
    }

    public static Class get(String interfaceName, URL url) {
        Map<URL,Class> map = registryCenter.get(interfaceName);
        Class clz = map.get(url);
        return clz;
    }
}
